package com.aaa.mbs.service.impl;

import com.aaa.common.util.Result;
import com.aaa.common.util.ResultStatus;
import com.aaa.mbs.dao.CouponHistoryDao;
import com.aaa.mbs.service.CouponHistoryService;
import com.aaa.mbs.vo.MemberCouponHistory;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: 10178
 * @Date: 2021/1/24 16:38
 * @Description:
 */
@Service
public class CouponHistoryServiceImpl implements CouponHistoryService {
    @Autowired
    private CouponHistoryDao couponHistoryDao;

    @Override
    public Result<PageInfo<MemberCouponHistory>> selectAll(Integer pageNo, Integer pageSize, String couponName, String memberName) {
        return new Result<>(ResultStatus.SUCCESS.getCode(),
                ResultStatus.SUCCESS.getMessage(), PageHelper.startPage(pageNo, pageSize).doSelectPageInfo(() -> couponHistoryDao.selectAll(couponName, memberName)));
    }
}
